# 拆分进站码
from PyQt5.QtWidgets import QMessageBox


def divide_code(code):
    parts = [code[:2], code[2:4], code[4:6], code[6:]]
    return parts


# 修改IP中的第三个值
def modify_ip(ip, third_value):
    parts = ip.split(".")
    if len(parts) != 4:
        return ip  # 如果 IP 格式不正确，直接返回原 IP

    parts[2] = str(third_value)
    modified_ip = ".".join(parts)
    return modified_ip


def show_message(self, title, content):
    msg_box = QMessageBox()
    msg_box.setIcon(QMessageBox.Information)
    msg_box.setWindowTitle(title)
    msg_box.setText(content)
    msg_box.setStandardButtons(QMessageBox.Ok)
    msg_box.exec_()
